<template>
	<view class="container" :style="'background: url('+seething.bgImg[0]+') no-repeat;'">
		<view class="logo">
			<image :src="seething.logo[0]" mode=""></image>
		</view>
		<view class="content_box"
			:style="'color: rgba('+seething.colors.rgba.r+','+seething.colors.rgba.r+','+seething.colors.rgba.r+','+1+')'">
			{{seething.content}}
			<view class="content">
				<view v-for="(item,index) in goodsList" :key="index">
					<view class="list_box">
						<view class="content_con">
							<view class="content_boxss">
								<view style="flex: 1;width: 580rpx;">
									<view style="flex: 1;padding: 20rpx;">
										<view class="content_boxsss">
											<view class="img_box">
												<image :src="item.pics" mode="aspectFill"></image>
											</view>
											<view class="big_infos">
												<view class="name">
													<view>{{item.item_name}}</view>
												</view>
												<view class="sku">
													<view>
														<text style="font-size: 24rpx;">￥</text>
														{{(Number(item.price)/100).toFixed(2)}}
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="button" v-if="detail.status == '1'" @click="linquFun"
			:style="'color: rgba('+seething.colors.rgba.r+','+seething.colors.rgba.r+','+seething.colors.rgba.r+','+1+')'">
			领取礼品</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: null,
				goodsList: null,
				detail: null,
				seething: null,
				giftCardData: null
			}
		},
		onLoad(opdata) {
			this.id = opdata.id
			this.giftCardData = JSON.parse(opdata.data)
			console.log(this.giftCardData);
			this.getDetail()
		},
		methods: {
			getDetail() {
				this.$allApi.getGiftCardDetail().then(res => {
					this.detail = res.data
					this.goodsList = res.data.goods.list
					this.seething = JSON.parse(res.data.page_data)
				})
			},
			linquFun() {
				let total = null
				for (let item of this.goodsList) {
					item.num = 1
					total += Number(item.price) / 100
					console.log(item.price / 100);
				}
				if (this.detail.gift_type == 1) {
					let newObj = {
						data: this.goodsList,
						total: '0.00',
						pay_type: 'lk',
						zj: total,
						giftCardData: this.giftCardData
					}
					uni.setStorageSync('orderPayData', JSON.stringify(newObj))
					this.$gourl('/pages/pay/giftPay')
				} else {
					this.$gourl('/pages/index/recharge')
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		.list_box {
			background: #FFFFFF;
			border-radius: 20rpx;
			margin-bottom: 30rpx;
		}

		.content_con {
			.head {
				padding: 20rpx 0;
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid #eee;

				.left {
					display: flex;
					align-items: center;

					image {
						width: 50rpx;
						height: 50rpx;
						border-radius: 10rpx;
						margin-right: 20rpx;
					}
				}
			}

			.content_boxss {
				margin-top: 20rpx;
				display: flex;
				// align-items: center;
				justify-content: space-between;
			}

			.content_boxsss {
				flex: 1;
				display: flex;
				justify-content: space-between;

				.img_box {
					width: 140rpx;
					height: 140rpx;

					image {

						width: 140rpx;
						height: 140rpx;
						border-radius: 20rpx;
					}
				}

				.big_infos {
					flex: 1;
					padding-left: 20rpx;
					color: #333;

					.name {
						font-size: 32rpx;
						display: flex;
						justify-content: space-between;
						align-items: center;
					}

					.sku {
						display: flex;
						line-height: 2;
						justify-content: space-between;
						align-items: center;
						color: red;
						font-weight: bold;
					}
				}
			}

			.small_info {
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				image {
					width: 95rpx;
					height: 95rpx;
					border-radius: 10rpx;
				}

				.infos {
					flex: 1;
					padding-left: 20rpx;
					width: 596rpx;
					line-height: 1.8;

					.name {
						text-overflow: -o-ellipsis-lastline;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;
					}

					.miaosu {
						font-size: 24rpx;
						color: #999;
					}
				}
			}
		}
	}

	.content_box {
		border: 1px dashed;
		padding: 20rpx;
		border-radius: 10rpx;
		font-size: 32rpx;
	}

	.button {
		width: 450rpx;
		height: 100rpx;
		border: 1px dashed;
		position: fixed;
		bottom: 110rpx;
		left: 150rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: bold;
		font-size: 48rpx;
		border-radius: 10rpx;
	}

	.container {
		min-height: 100vh;
		// #ifdef H5
		min-height: calc(100vh - 44px);
		// #endif
		background-size: 100% 100% !important;
		background-position: center !important;
		padding: 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
	}

	.logo {
		position: absolute;
		top: 30rpx;
		left: 30rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		image {
			width: 264rpx;
			height: 108rpx;
		}
	}
</style>